package com.sugon.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.SpareStorePosExchangeDao;
import com.sugon.entity.SpareStorePosExchangeEntity;
import com.sugon.service.SpareStorePosExchangeService;
import com.sugon.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 备件移库记录Service实现类
 *
 * @author sugon
 * @date 2020-09-01 16:35:23
 */
@Service("spareStorePosExchangeService")
public class SpareStorePosExchangeServiceImpl implements SpareStorePosExchangeService {
    @Autowired
    private SpareStorePosExchangeDao spareStorePosExchangeDao;

    @Override
    public SpareStorePosExchangeEntity queryObject(String id) {
        return spareStorePosExchangeDao.queryObject(id);
    }

    @Override
    public List<SpareStorePosExchangeEntity> queryList(Map<String, Object> map) {
        return spareStorePosExchangeDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return spareStorePosExchangeDao.queryTotal(map);
    }

    @Override
    public int save(SpareStorePosExchangeEntity spareStorePosExchange) {
        spareStorePosExchange.setId(RandomUtil.randomString(32));
        spareStorePosExchange.setOperatorId(ShiroUtils.getUserId());
        spareStorePosExchange.setGmtCreate(DateUtil.date());
        return spareStorePosExchangeDao.save(spareStorePosExchange);
    }

    @Override
    public int update(SpareStorePosExchangeEntity spareStorePosExchange) {
        return spareStorePosExchangeDao.update(spareStorePosExchange);
    }

    @Override
    public int delete(String id) {
        return spareStorePosExchangeDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return spareStorePosExchangeDao.deleteBatch(ids);
    }
}
